Python syntax and semantics
part 5/45 · 74.8 KB total
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
In addition, Python also has 3 soft keywords. Unlike regular hard keywords, soft keywords are reserved words only in the limited contexts where interpreting them as keywords would make syntactic sense. These words can be used as identifiers elsewhere, in other words, match and case are valid names for functions and variables.cite-ref-9[6]cite-ref-pep-0622-10-0[7]
• _cite-ref-keywordin310-11-0[note 4]
• casecite-ref-keywordin310-11-1[note 4]
• matchcite-ref-keywordin310-11-2[note 4]
Notes
cite-note-becamekeywordin3-7note 2. ↑ True and False became keywords in Python 3.0. Previously they were global variables.
cite-note-keywordin3-8note 3. ↑ nonlocal was introduced in Python 3.0.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────